<template>
	<view>
		<van-cell-group>
			<van-cell v-for="value in 10" :key="value" title="同学" clickable @click="getClassmatesCourse" />
		</van-cell-group>
		<van-notify id="van-notify" />

	</view>
</template>

<script>
	import Notify from '../../wxcomponents/vant/dist/notify/notify';
	export default {
		name: "classmate",
		data() {
			return {
				banji: "",
				college: "",
				grade: null,
				major: "",
				openid: "",
				school: "",
				classmateNum: null
			};
		},
		beforeMount() {
			this.getMyInfo()
		},
		onLoad() {
			this.getClassmatesCourse()
		},
		methods: {
			getMyInfo() {
				let self = this
				uni.request({
					url: getApp().globalData.baseURL + "/user/getUser",
					data: {
						"openid": wx.getStorageSync('openid')
					},
					header: {
						"token": wx.getStorageSync('token')
					},
					success: (res) => {
						self.banji = res.data.data.banji
						self.college = res.data.data.college
						self.grade = res.data.data.grade
						self.major = res.data.data.major
						self.school = res.data.data.school
					},
					fail: (err) => {
						Notify({
							type: 'danger',
							message: '请求失败,请检查您的网络连接',
						});
					}
				})
			},
			getClassmatesCourse() {
				let self = this
				uni.request({
					url: getApp().globalData.baseURL + "/user/selectByBanji",
					data: {
						"school": this.school,
						"college": this.college,
						"major": this.major,
						"grade": this.grade,
						"banji": this.banji
					},
					header: {
						"token": wx.getStorageSync('token')
					},
					success: (res) => {
						console.log(res)

					},
					fail: (err) => {
						Notify({
							type: 'danger',
							message: '请求失败,请检查您的网络连接',
						});
					}
				})
			}
		}
	}
</script>

<style>

</style>
